//
// Created by ta&to on 2022/9/28.
//

#ifndef HTTPSERVER_HTTP_CONNECT_H
#define HTTPSERVER_HTTP_CONNECT_H
#define MAXCLINE 512 //连接队列中的个数

// 切换IO模型
#ifndef SOCKET_SERVER_SELECT
//#define SOCKET_SERVER_SELECT 1
#endif
#if !defined(SOCKET_SERVER_SELECT) && !defined(SOCKET_SERVER_POLL)
//#define SOCKET_SERVER_POLL 1
#endif
#if !defined(SOCKET_SERVER_SELECT) && !defined(SOCKET_SERVER_POLL) && !defined(SOCKET_SERVER_EPOLL)
#define SOCKET_SERVER_EPOLL 1
#endif

#include "http_socket.h"

int conn_handler(log_t *logt, http_socket_event_loop_t *hset, http_socket_event_handle_t * handler);
void conn_init(thread_pool_t *tpt, log_t *logt, http_socket_event_loop_t *hset, int listen_port, int outtime_sec, void* __socket_r_func, void* __socket_w_func);
void http_init(thread_pool_t *tpt, log_t *logt, http_socket_event_loop_t *hset, void* func);
void add_event(log_t *logt, http_socket_event_loop_t *hset, int fd, uint32_t events);
int  del_event(log_t *logt, http_socket_event_loop_t *hset, int fd);
#if defined(SOCKET_SERVER_SELECT)
void init_select(log_t *logt, http_socket_event_loop_t *hset);
void create_select(log_t *logt, http_socket_event_loop_t *hset);
#endif
#if defined(SOCKET_SERVER_POLL)
void init_poll(log_t *logt, http_socket_event_loop_t *hset);
void create_poll(log_t *logt, http_socket_event_loop_t *hset);
#endif
#if defined(SOCKET_SERVER_EPOLL)
void init_epoll(log_t *logt, http_socket_event_loop_t *hset);
int create_epoll(log_t *logt, http_socket_event_loop_t *hset);
#endif
#endif //HTTPSERVER_HTTP_CONNECT_H
